package cn.bandeqing.douyin.util;

import cn.bandeqing.base.resp.Resp;
import cn.bandeqing.frame.exception.CodeException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.http.client.Request;
import org.dromara.hutool.http.client.Response;
import org.dromara.hutool.http.client.engine.jdk.JdkClientEngine;
import org.dromara.hutool.http.meta.ContentType;
import org.dromara.hutool.http.meta.HeaderName;
import org.dromara.hutool.http.meta.Method;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONUtil;

@Slf4j
public class DouYinUtil {

    public static final JdkClientEngine engine = new JdkClientEngine();
    public static final String client_token_url = "https://open.douyin.com/oauth/client_token/";
    public static AccessToken access_token;

    /**
     * <a href="https://partner.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/client-token">...</a>
     *
     * @return client token
     */
    public synchronized static String clientToken() {
        if (access_token != null && StrUtil.isNotBlank(access_token.getAccessToken())
                && System.currentTimeMillis() - access_token.getTime() < 7190_000) {
            return access_token.getAccessToken();
        }

        JSONObject jo = JSONUtil.ofObj()
                .set("client_key", "awds90k15zk2v7rh")
                .set("client_secret", "0f21d8b5f8d76f9affbe236e594eb18f")
                .set("grant_type", "client_credential");
        String param = jo.toString();
        System.out.println(param);
        Request request = Request.of(client_token_url)
                .method(Method.POST)
                .header(HeaderName.CONTENT_TYPE, ContentType.JSON.getValue())
                .body(param);
        Response response = engine.send(request);
        if (response.isOk()) {
//            {
//                "data": {
//                "access_token": "clt.06def021709cf24b2e1fc4b0caa4ae85zDkqjN1996f6K59jlvz1Qyt3JVBR",
//                        "captcha": "",
//                        "desc_url": "",
//                        "description": "",
//                        "error_code": 0,
//                        "expires_in": 7200,
//                        "log_id": "20231016160728EAAC075F6C2DA70421F9"
//            },
//                "message": "success"
//            }
            String bodyStr = response.bodyStr();

            log.info("clientToken bodyStr = {}", bodyStr);

            JSONObject r = JSONUtil.parseObj(bodyStr);
            JSONObject data = r.getJSONObject("data");
            if (data != null && !data.isEmpty()) {
                String accessToken = data.getStr("access_token");
                if (StrUtil.isNotBlank(accessToken)) {
                    access_token = new AccessToken(accessToken, System.currentTimeMillis());
                    return accessToken;
                }
            }
        }

        throw new RuntimeException("无法获取clientToken");
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    static class AccessToken {
        private String accessToken;
        private Long time;
    }

    /**
     * @param code 券码
     * @return {"data":{"certificates_v2":[{"amount":{"pay_amount":29800,"coupon_pay_amount":29800,"list_market_amount":79200,"original_amount":29800},"certificate_id":7349446788745379850,"encrypted_code":"CgYIASAHKAESLgosx+RNmsRBFrAcHazrZ7xkIo2QALGiYfKL19CoqE4Gr4twKx4t7Le1531DAQ8aAA==","expire_time":1742313599,"sku":{"groupon_type":1,"market_price":79200,"sku_id":"7346770452632569891","sold_start_time":1710518400,"third_sku_id":"open_2024031609442766837","title":"轻松躺平的搬家打包","account_id":"7319398883099707426"},"start_time":1711176425}],"order_id":"1032196411078106919","verify_token":"1c229bf9-6ebc-44e1-94de-d07b7e961140","certificates":[{"amount":{"coupon_pay_amount":29800,"list_market_amount":79200,"original_amount":29800,"pay_amount":29800},"certificate_id":7349446788745379850,"encrypted_code":"CgYIASAHKAESLgosTmCzyJ2gLI320e6lb6RxWAVQeCzoA37Xn+E638eMD/egPdPZCL0M7LMBOtQaAA==","expire_time":1742313599,"sku":{"sold_start_time":1710518400,"third_sku_id":"open_2024031609442766837","title":"轻松躺平的搬家打包","account_id":"7319398883099707426","groupon_type":1,"market_price":79200,"sku_id":"7346770452632569891"},"start_time":1711176425}],"error_code":0,"description":"success"},"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"20240323163112DA46FC2ECB50C4AF6653","now":1711182672}}
     */
    public static JSONObject prepare(String code) {
        // https://developer.open-douyin.com/docs/resource/zh-CN/local-life/develop/OpenAPI/life.capacity.fulfilment/certificate.prepare
        Request request = Request.of("https://open.douyin.com/goodlife/v1/fulfilment/certificate/prepare/?code=" + code)
                .header("access-token", clientToken());
        Response response = engine.send(request);
        if (response.isOk()) {
            String bodyStr = response.bodyStr();
            // {"data":{"certificates_v2":[{"amount":{"pay_amount":29800,"coupon_pay_amount":29800,"list_market_amount":79200,"original_amount":29800},"certificate_id":7349446788745379850,"encrypted_code":"CgYIASAHKAESLgosx+RNmsRBFrAcHazrZ7xkIo2QALGiYfKL19CoqE4Gr4twKx4t7Le1531DAQ8aAA==","expire_time":1742313599,"sku":{"groupon_type":1,"market_price":79200,"sku_id":"7346770452632569891","sold_start_time":1710518400,"third_sku_id":"open_2024031609442766837","title":"轻松躺平的搬家打包","account_id":"7319398883099707426"},"start_time":1711176425}],"order_id":"1032196411078106919","verify_token":"1c229bf9-6ebc-44e1-94de-d07b7e961140","certificates":[{"amount":{"coupon_pay_amount":29800,"list_market_amount":79200,"original_amount":29800,"pay_amount":29800},"certificate_id":7349446788745379850,"encrypted_code":"CgYIASAHKAESLgosTmCzyJ2gLI320e6lb6RxWAVQeCzoA37Xn+E638eMD/egPdPZCL0M7LMBOtQaAA==","expire_time":1742313599,"sku":{"sold_start_time":1710518400,"third_sku_id":"open_2024031609442766837","title":"轻松躺平的搬家打包","account_id":"7319398883099707426","groupon_type":1,"market_price":79200,"sku_id":"7346770452632569891"},"start_time":1711176425}],"error_code":0,"description":"success"},"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"20240323163112DA46FC2ECB50C4AF6653","now":1711182672}}
            log.info("prepare bodyStr = {}", bodyStr);
            return JSONUtil.parseObj(bodyStr);
        }
        throw new CodeException("网络异常 调用抖音服务器验券失败");
    }

    /**
     * @param verifyToken   token
     * @param poiId         店铺
     * @param encryptedCode 抖音
     * @param orderId       抖音orderID
     * @return 返回结果
     */
    public static JSONObject certificateVerify(String verifyToken, String poiId, String encryptedCode, String orderId) {
        String param = JSONUtil.ofObj()
                .set("verify_token", verifyToken)
                .set("poi_id", poiId)
                .set("encrypted_codes", JSONUtil.ofArray()
                        .put(encryptedCode))
                .set("order_id", orderId)
                .toString();
        // https://partner.open-douyin.com/docs/resource/zh-CN/local-life/develop/OpenAPI/life.capacity.fulfilment/certificate.verify
        Request request = Request.of("https://open.douyin.com/goodlife/v1/fulfilment/certificate/verify/")
                .method(Method.POST)
                .header(HeaderName.CONTENT_TYPE, ContentType.JSON.getValue())
                .header("access-token", clientToken())
                .body(param);
        Response response = engine.send(request);
        if (response.isOk()) {
            String bodyStr = response.bodyStr();
            log.info("certificateVerify bodyStr = {}", bodyStr);
            return JSONUtil.parseObj(bodyStr);
        }
        throw new CodeException("网络异常 调用抖音服务器验券失败");
    }

    /**
     * <a href="https://developer.open-douyin.com/docs/resource/zh-CN/local-life/develop/OpenAPI/life.capacity.fulfilment/certificate.prepare">...</a>
     *
     * @param code 券码
     */
    public static Resp<?> verify(String code, String poiId) {
        Request request = Request.of("https://open.douyin.com/goodlife/v1/fulfilment/certificate/prepare/?code=" + code)
//                .header(HeaderName.CONTENT_TYPE, ContentType.JSON.getValue())
                .header("access-token", clientToken());
        Response response = engine.send(request);
        if (response.isOk()) {
            // {"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"202310181654383F7E206A31165A06E90E","now":1697619279},"data":{"certificates":[{"amount":{"pay_amount":8999,"payment_discount_amount":1,"coupon_pay_amount":9000,"list_market_amount":10000,"original_amount":9000},"certificate_id":7290470822191185955,"encrypted_code":"CgwIARDhJxjLLyABKAESLgosjD5Dk9etWwJE7IliyQ/iKqCVaheMdHDym1AYFYmTlQxZX8ssZJ3fVZ4yxpAaAA==","expire_time":1713023999,"sku":{"sku_id":"1777729681496100","sold_start_time":1695374348,"third_sku_id":"00001","title":"90代100元代金券","account_id":"7226613193710241829","groupon_type":2,"market_price":10000},"start_time":1697445025}],"order_id":"1012488620206748457","verify_token":"cedc12d3-9e97-4fac-a69c-fba6015d38e8","error_code":0,"description":"success"}}
            String bodyStr = response.bodyStr();
            if (StrUtil.isNotBlank(bodyStr)) {
                System.out.println(bodyStr);
                JSONObject o = JSONUtil.parseObj(bodyStr);
                JSONObject data = o.getJSONObject("data");
                if (data != null && !data.isEmpty()) {
                    Integer errorCode = data.getInt("error_code", -1);
                    if (errorCode != 0) {
                        String description = data.getStr("description");
                        System.out.println(description);
                        return Resp.error(description);
                    }
                    String verifyToken = data.getStr("verify_token");
                    String orderId = data.getStr("order_id");
                    JSONArray certificates = data.getJSONArray("certificates");
                    if (certificates == null || certificates.isEmpty()) {
                        // 已经核销
                        log.error("已经验过券");
                        return Resp.error("已经验过券");
                    }
                    if (StrUtil.isNotBlank(verifyToken) && StrUtil.isNotBlank(orderId)) {
//                        JSONObject one = certificates.getJSONObject(0);

                        for (Object temp : certificates) {
                            JSONObject one = (JSONObject) temp;

                            String encryptedCode = one.getStr("encrypted_code");
                            JSONObject sku = one.getJSONObject("sku");
                            // 90代100元代金券
                            String title = sku.getStr("title");
                            // 10000
                            int marketPrice = sku.getInt("market_price") / 100;
                            JSONObject amount = one.getJSONObject("amount");
                            // 9000
//                            int couponPayAmount = amount.getInt("coupon_pay_amount") / 100;

                            // 改成原来金额
                            int couponPayAmount = amount.getInt("original_amount") / 100;
                            if (StrUtil.isNotBlank(encryptedCode)) {
                                String param = JSONUtil.ofObj()
                                        .set("verify_token", verifyToken)
                                        .set("poi_id", poiId)
                                        .set("encrypted_codes", JSONUtil.ofArray()
                                                .put(encryptedCode))
                                        .set("order_id", orderId)
                                        .toString();
                                // https://partner.open-douyin.com/docs/resource/zh-CN/local-life/develop/OpenAPI/life.capacity.fulfilment/certificate.verify
                                request = Request.of("https://open.douyin.com/goodlife/v1/fulfilment/certificate/verify/")
                                        .method(Method.POST)
                                        .header(HeaderName.CONTENT_TYPE, ContentType.JSON.getValue())
                                        .header("access-token", clientToken())
                                        .body(param);
                                response = engine.send(request);
                                if (response.isOk()) {
                                    bodyStr = response.bodyStr();
//                                    System.out.println(bodyStr);
                                    log.info("bodyStr = {}", bodyStr);
                                    // {"data":{"verify_results":[{"result":0,"verify_id":"7291219181465241615","account_id":"7226613193710241829","certificate_id":"7290470822191185955","code":"CgwIARDhJxjLLyABKAESLgosjD5Dk9etWwJE7IliyQ/iKqCVaheMdHDym1AYFYmTlQxZX8ssZJ3fVZ4yxpAaAA==","msg":"履约成功","order_id":"1012488620206748457","origin_code":"110136070954466"}],"error_code":0,"description":"success"},"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"20231018165439E063005786E6320538D8","now":1697619279}}
                                    JSONObject entries = JSONUtil.parseObj(bodyStr);
                                    data = entries.getJSONObject("data");
                                    if (data != null && !data.isEmpty()) {
                                        errorCode = data.getInt("error_code", -1);

                                        if (errorCode == 0) {


                                            return Resp.success();
                                        } else {
                                            String description = data.getStr("description");
                                            return Resp.error(description);
                                        }

//                                        if (errorCode == 0) {
//                                            //
//                                            IOrderService orderService = SpringUtils.getBean(IOrderService.class);
//                                            SmsService smsService = SpringUtils.getBean(SmsService.class);
//                                            IPayService payService = SpringUtils.getBean(IPayService.class);
//                                            IOrderScheduleService orderScheduleService = SpringUtils.getBean(IOrderScheduleService.class);
//                                            IOrderDiscountsService orderDiscountsService = SpringUtils.getBean(IOrderDiscountsService.class);
//                                            Order order = orderService.selectById(ordersId, "id", "city_type", "laddie_number",
//                                                    "pre_pay", "status", "source", "added_services", "move_time", "total_price",
//                                                    "discount_amount", "cancel_after_verification", "product_id", "responsible_id", "responsible");
//                                            Double prePay = order.getPrePay() == null ? couponPayAmount : order.getPrePay() + couponPayAmount;
//                                            Order update = Order.builder()
//                                                    .id(ordersId)
//                                                    .prePay(prePay)
//                                                    .updateTime((int) (System.currentTimeMillis() / 1000))
//                                                    .updateUserName(userName)
//                                                    .updateUserId(userId)
//                                                    .build();
//                                            if (order.getStatus() == 1 || order.getStatus() == 0 || order.getStatus() == 4) {
//                                                // 订单状态 待付定金 || 待确认 || 取消 修改为已确认
//                                                update.setStatus(2);
//                                                smsService.informCustomer(order);
//                                                orderScheduleService.highAltitudeDispatchOrder(order, update);
//                                                // 15点17分
//                                                orderService.confirmOrder(order, userId, userName);
//                                            }
////                                            else {
////                                                return AjaxResult.error("订单状态不是 待付定金 待确认 取消");
////                                            }
//                                            // price = 优惠金额
//                                            double price = marketPrice - couponPayAmount;
//                                            if (price > 0 && ("90代100元代金券".equals(title) || marketPrice == 10000)) {
//                                                double discountAmount = order.getDiscountAmount() == null ? 0.0 : order.getDiscountAmount();
//                                                update.setDiscountAmount(discountAmount + price);
//                                                OrderDiscounts insert = OrderDiscounts.builder()
//                                                        .orderId(order.getId())
//                                                        .discountAmount(price)
//                                                        .createTime((int) (System.currentTimeMillis() / 1000))
//                                                        .createUserId(userId)
//                                                        .createUserName(userName)
//                                                        .delFlag(false)
//                                                        .type(3)
//                                                        .remark("抖音" + title + "优惠" + price + "，" + remark)
//                                                        .build();
//                                                double totalPrice = order.getTotalPrice() == null ? 0.0 : order.getTotalPrice();
//                                                update.setTotalPrice(totalPrice - price);
//                                                int i = orderDiscountsService.insert(insert);
//                                                if (i == 0) {
//                                                    return AjaxResult.error("优惠金额添加失败");
//                                                }
//                                            }
//                                            int i = orderService.updateById(update, true, order.getCancelAfterVerification());
//                                            if (i == 0) {
//                                                return AjaxResult.error("订单更新失败");
//                                            }
//                                            Pay pay = Pay.builder()
//                                                    .orderId(ordersId)
//                                                    .type(32)
//                                                    .source(0)
//                                                    .money((double) couponPayAmount)
//                                                    .remark(code)
//                                                    .createTime((int) (System.currentTimeMillis() / 1000))
//                                                    .createUserName(userName)
//                                                    .createUserId(userId)
//                                                    .delFlag(false)
//                                                    .build();
//                                            int insert = payService.insert(pay);
//                                            if (insert == 0) {
//                                                return AjaxResult.error("支付记录插入失败");
//                                            }
//                                            return AjaxResult.success();
//                                        } else {
//                                            String description = data.getStr("description");
//                                            return AjaxResult.error(description);
//                                        }
                                    }
                                }
                            }
                        }

                    }
                }
            }
        }
        return Resp.error();
    }

    public static void poiQuery() {
        Response response = engine.send(Request.of(StrUtil.format("https://open.douyin.com/goodlife/v1/shop/poi/query/?account_id={}&page=1&size=10", "7319398883099707426"))
                .header("access-token", clientToken()));
        if (response.isOk()) {
            // {"data":{"pois":[{"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"account":{"poi_account":{"account_id":"7278971998884071480","account_name":"斑马搬家","account_type":"Shop"},"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"parent_account":{"account_name":"个体","account_type":"Trademark","account_id":"7290856349271951375"}},"poi":{"address":"新安街道建安社区建安一路裕富巷1号1层2号","latitude":22.566938,"longitude":113.902271,"poi_id":"6633397942520645636","poi_name":"斑马搬家"}},{"account":{"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"parent_account":{"account_id":"7290856349271951375","account_name":"个体","account_type":"Trademark"},"poi_account":{"account_id":"7281491685673912357","account_name":"斑马搬家(车陂店)","account_type":"Shop"}},"poi":{"poi_id":"6860981429963065356","poi_name":"斑马搬家(车陂店)","address":"加悦大厦14楼1422","latitude":23.123899,"longitude":113.394569},"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"}},{"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"account":{"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"parent_account":{"account_id":"7290856349271951375","account_name":"个体","account_type":"Trademark"},"poi_account":{"account_id":"7281491997246883899","account_name":"斑马搬家(越秀店)","account_type":"Shop"}},"poi":{"address":"北京路194号银座广场","latitude":23.122321,"longitude":113.269115,"poi_id":"6891215939363145736","poi_name":"斑马搬家(越秀店)"}},{"account":{"poi_account":{"account_id":"7281530421198800936","account_name":"深圳市斑马搬家服务有限公司佛山分公司","account_type":"Shop"},"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"},"parent_account":{"account_type":"Trademark","account_id":"7290856349271951375","account_name":"个体"}},"poi":{"poi_id":"7281537230722566155","poi_name":"深圳市斑马搬家服务有限公司佛山分公司","address":"祖庙街道东建大厦","latitude":23.027572,"longitude":113.107821},"root_account":{"account_type":"Trademark","account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司"}},{"account":{"parent_account":{"account_id":"7290856349271951375","account_name":"个体","account_type":"Trademark"},"poi_account":{"account_id":"7282641189839439884","account_name":"斑马搬家服务(东莞)有限公司","account_type":"Shop"},"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"}},"poi":{"address":"莞城街道东纵路莞城段124号盈锋广场1号楼1单元508室","latitude":23.037144,"longitude":113.776254,"poi_id":"7282655012839229451","poi_name":"斑马搬家服务(东莞)有限公司"},"root_account":{"account_id":"7226613193710241829","account_name":"深圳市斑马搬家服务有限公司","account_type":"Trademark"}}],"total":5,"error_code":0,"description":"success"},"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"20231018162901290E97352F888303DCC2","now":1697617742}}
            // {"data":{"pois":[{"account":{"parent_account":{"account_type":"Trademark","account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司"},"poi_account":{"account_id":"7330226763114481691","account_name":"斑得清搬家(东莞店)","account_type":"Shop"}},"poi":{"address":"东城街道莞长路东城段143号6栋810室","latitude":22.963061,"longitude":113.771371,"poi_id":"7329376000855246863","poi_name":"斑得清搬家(东莞店)"},"root_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},{"account":{"parent_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"},"poi_account":{"account_name":"斑得清搬家(呈贡区店)","account_type":"Shop","account_id":"7330523625633613851"}},"poi":{"address":"乌龙街道办事处乌龙社区居委会奥宸滇池星城星皓湾2栋2单元102","latitude":24.852359,"longitude":102.803492,"poi_id":"7330551592284964904","poi_name":"斑得清搬家(呈贡区店)"},"root_account":{"account_type":"Trademark","account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司"}},{"account":{"parent_account":{"account_type":"Trademark","account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司"},"poi_account":{"account_id":"7330538499887204386","account_name":"斑得清搬家喜糖(朝阳区店)","account_type":"Shop"}},"poi":{"address":"王四营官庄大队唐家坟村北京王府井百货集团股份有限公司仓库4幢2层4017室","latitude":39.885554,"longitude":116.503703,"poi_id":"7330588744736573479","poi_name":"斑得清搬家喜糖(朝阳区店)"},"root_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},{"account":{"poi_account":{"account_name":"斑得清搬家有亿家(曲江新区店)","account_type":"Shop","account_id":"7337800668655044608"},"parent_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},"poi":{"address":"曲江新区雁塔南路金辉环球中心C座1802室","latitude":34.180642,"longitude":108.96622,"poi_id":"7337666991958558772","poi_name":"斑得清搬家有亿家(曲江新区店)"},"root_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},{"account":{"parent_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"},"poi_account":{"account_id":"7345689544824244274","account_name":"斑得清搬家(景洪市店)","account_type":"Trademark"}},"poi":{"longitude":100.823501,"poi_id":"7340462622879254554","poi_name":"斑得清搬家(景洪市店)","address":"允景洪街道办事曼景兰社区居委会览江苑15号楼2单元507","latitude":21.992785},"root_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},{"account":{"parent_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"},"poi_account":{"account_id":"7348031124326598696","account_name":"斑得清搬家得龙(南开区店)","account_type":"Trademark"}},"poi":{"address":"凌宾路凌奥创意产业园2号楼3单元8206","latitude":39.062118,"longitude":117.168922,"poi_id":"7338181015245948991","poi_name":"斑得清搬家得龙(南开区店)"},"root_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"}},{"root_account":{"account_type":"Trademark","account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司"},"account":{"parent_account":{"account_id":"7319398883099707426","account_name":"广东斑得清生活服务有限公司","account_type":"Trademark"},"poi_account":{"account_id":"7348360741609359386","account_name":"斑得清福莱(天河区店)","account_type":"Trademark"}},"poi":{"poi_id":"7330572709392287785","poi_name":"斑得清福莱(天河区店)","address":"黄埔大道656号2901房A009","latitude":23.115449,"longitude":113.381676}}],"total":7,"error_code":0,"description":"success"},"extra":{"error_code":0,"description":"success","sub_error_code":0,"sub_description":"","logid":"2024032315232790731A8594FD1F939852","now":1711178608}}
            String bodyStr = response.bodyStr();
            System.out.println(bodyStr);
            log.info("poiQuery bodyStr = {}", bodyStr);
        }
    }

//    public static void main(String[] args) {
//        prepare("120228683268162");
//        poiQuery();
//        String clientToken = clientToken();
//        System.out.println(clientToken);
//        AjaxResult verify = verify("110136070954466", "6633397942520645633");
//        System.out.println(verify);
//        poiQuery();
//    }

}
